/**
 * 
 */
package moviles.turnomovil.interfaz;

import moviles.app.mundo.R;
import moviles.turnomovil.mundo.Alerta;
import moviles.turnomovil.mundo.TurnoMovil;
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * @author juanjo
 *
 */
public class VerAlertasActivity extends Activity {

	private Alerta[] alertas;
	
	private LinearLayout layout;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.lyveralertas);
		initAlertas();
	}

	private void initAlertas() {
		// TODO Auto-generated method stub
		alertas = TurnoMovil.getInstance().getAlertas();
		layout = (LinearLayout) findViewById(R.id.lineallyAlertas);
		
		for( int i= 0; i < alertas.length ; i++ )
		{
			if(alertas[i] != null )
			{
				TextView txtAlerta = new TextView(this);
			    txtAlerta.setText(alertas[i].toString());
			    txtAlerta.setLayoutParams( new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
			    layout.addView(txtAlerta);
			}
		}
		layout.refreshDrawableState();
	}
}
